package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.UserTrainMapper;
import com.ly.heart.service.IUserTrainService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.UserTrainEntity;

import javax.annotation.Resource;

/**
 * 人员培训记录Service业务层处理
 * @author wutao
 * @date 2024-05-31
 */
@Service
public class UserTrainServiceImpl extends ServiceImpl<UserTrainMapper, UserTrainEntity> implements IUserTrainService {

    @Resource
    private UserTrainMapper userTrainEntityMapper;

    /**
     * 查询人员培训记录
     * @param id 人员培训记录ID
     * @return 人员培训记录
     */
    @Override
    public UserTrainEntity selectUserTrainEntityById (String id) {
        return userTrainEntityMapper.selectUserTrainEntityById ( id );
    }

    /**
     * 查询人员培训记录列表
     * @param userTrainEntity 人员培训记录
     * @return 人员培训记录
     */
    @Override
    public List<UserTrainEntity> selectUserTrainEntityList (UserTrainEntity userTrainEntity) {
        return userTrainEntityMapper.selectUserTrainEntityList ( userTrainEntity );
    }

    /**
     * 新增人员培训记录
     * @param userTrainEntity 人员培训记录
     * @return 结果
     */
    @Override
    public int insertUserTrainEntity (UserTrainEntity userTrainEntity) {
        userTrainEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        userTrainEntity.setCreateTime ( DateUtils.getNowDate () );
        return userTrainEntityMapper.insertUserTrainEntity ( userTrainEntity );
    }

    /**
     * 修改人员培训记录
     * @param userTrainEntity 人员培训记录
     * @return 结果
     */
    @Override
    public int updateUserTrainEntity (UserTrainEntity userTrainEntity) {
        userTrainEntity.setUpdateTime ( DateUtils.getNowDate () );
        return userTrainEntityMapper.updateUserTrainEntity ( userTrainEntity );
    }

    /**
     * 批量删除人员培训记录
     * @param ids 需要删除的人员培训记录ID
     * @return 结果
     */
    @Override
    public int deleteUserTrainEntityByIds (String[] ids) {
        return userTrainEntityMapper.deleteUserTrainEntityByIds ( ids );
    }

    /**
     * 删除人员培训记录信息
     * @param id 人员培训记录ID
     * @return 结果
     */
    @Override
    public int deleteUserTrainEntityById (String id) {
        return userTrainEntityMapper.deleteUserTrainEntityById ( id );
    }
}
